<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
class IndexController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()

    {  

        //查询相关描述为轮播图的图片
       $list =DB::table("display")->where('content','like','%轮播%')
                                    ->where('status','=','1')
                                    ->limit(5)
                                    ->get();
                                    //dd($list);
        //推荐商品                          
       $list1 =DB::table("display")->where('content','like','%推荐%')
                                    ->where('status','=','1')
                                     ->limit(4)
                                    ->get();
        //获取表中商品的信息
        $list2=DB::table('cate')->get();
          
            return view('home.index',[   'list'=>$list,
                                           'list1'=>$list1,                                          
                                            'list2'=>$list2
                                            ]);   

       }



       

   
   

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
